// components/index/good-three/good-three.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    num: {
      type:Number,
      value: 1
    },
    item: {
      type: Object,
      value: ()=>({})
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    goTo(){
      wx.navigateTo({
        url:"/pages/goods/goods?id="+this.data.item.commodityId,
      })
    },
    addCart(){
      // this.triggerEvent("add", this.data.item.commodityId, 1, "add");
      this.triggerEvent("add", {
        id: this.data.item.commodityId,
        update: 1
      });
    },
    minusCart(){
      // this.triggerEvent("minus", this.data.item.commodityId, -1, "minus");
      this.triggerEvent("minus", {
        id: this.data.item.commodityId,
        update: -1
      });
    }
  }
})
